const mysql =require('mysql')
const pool = mysql.createPool({
   host:'localhost',
   user:'root',
   password:'root',
   database:'2113_crud'
})

function exec(sql){
   return new Promise((resolve,reject)=>{
      pool.query(sql,(err,data)=>{
         if(err){
            reject(err)
         }
         resolve(data)
      })
   })
}

module.exports={
   exec
}